<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
    <iframe 
        src="https://www.baidu.com" 
        frameborder="1"
        width="800"
        height="800"
        id="inner"
    ></iframe>

    <script>
        var inner = document.querySelector("#inner");
        var inner_doc = inner.contentWindow.document;
        var inner_win = inner.contentWindow;

        var html_header = "data:text/html;charset=utf-8,"
        var html_content = "<h1>hello</h1>"
        var html_node = document.createElement("h2");
        html_node.innerHTML = "hello node";

        window.addEventListener('click', function(){
            console.log("click");
            console.log(inner_win.location.assign("https://www.google.com"));
        })
    </script>
</body>
</html>